package java8_26.chongwu;

/**
 * @author oldliu
 * @since 1.0
 */
public class PetTest9 {
    public static void main(String[] args) {
        //Pet t=new Tiger("小美丽","母",40,90);
        Pet t=new Dog("小美丽","母",40,90);
        t.eat();
        t.print();
        if(t instanceof Tiger){
            //((Tiger) t).shout();//1
            Tiger tiger=(Tiger)t;//2
            //t.shout();
            tiger.shout();
        }else {
            System.out.println("这不是老虎");
        }

        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>");
        System.out.println(t instanceof  Object);//一定是true
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>");
        Object t2=null;
        System.out.println(t2 instanceof Tiger);//true or false?
        System.out.println(t2 instanceof Object);//null可以被转换成任意对象，instanceof都是false
        Tiger ddd=(Tiger)t2;
    }
}
